package com.ychs.dpmms.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * copyright(c)2021 YYB.ALL rights Reserved
 * <p>
 * 描述:
 *
 * @author 原玉波
 * @version 1.0
 * @date 2021/5/23
 */
public class DateUtil {
    public static String dateToString(Date date){
        SimpleDateFormat format
                = new SimpleDateFormat("yyyy-MM-dd");
        return format.format(date);
    }

    public static Date StringToDate(String dateStr){
        SimpleDateFormat format;
        format = new SimpleDateFormat("yyyy-MM-dd");
        Date newDate = null;
        try {
            newDate = format.parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return newDate;
    }
}
